// 声明装饰器修饰方法/属性
function method(
  target: any,
  propertyKey: string,
  descriptor: PropertyDescriptor
) {
  console.log("target=", target);
  console.log("pk=" + propertyKey);
  console.log("desc=" + JSON.stringify(descriptor) + "\n\n");

  // 让当前属性(say)不可编辑
  descriptor.writable = false;
}

function property(target: any, propertyKey: string) {
  console.log("target", target);
  console.log("propertyKey", propertyKey);
}

class PersonIII {
  @property
  name: string;

  constructor() {
    this.name = "huihui";
  }

  @method
  sayHello() {
    console.log("基尼太美");
  }

  @method
  static run() {
    return "static method";
  }
  
}

const xhf = new PersonIII();

// 修改实例方法say
xhf.sayHello = function () {
  console.log("亭前一席话，胜坐十年牢");
};

xhf.sayHello();
